{% extends 'base.html' %}
{% load static %}
{% block title %}工资条管理 - 上传工资表{% endblock %}
{% block content %}
{% block custom_js %}
    <script>
        function btn_cancel() {
            location.href = "{% url 'index' %}";
        }
    </script>
    <script type="text/javascript">
    $(document).ready(function () {
        bsCustomFileInput.init();
        });
</script>
    <script>
        $(function () {
            //隐藏div
            $("#bufa").hide();
            //添加事件
            $("#operate").change(function () {
                if($(this).val() == 1){
                    $("#bufa").hide();
                    $("#curent").show();
                }else {
                    $("#curent").hide();
                    $("#bufa").show();
                }
            })
        })
    </script>
{% endblock %}
<!-- 内容标题栏 -->
<div class="content-header">
    <div class="container-fluid">
        <div class="row mb-2">
            <div class="col-sm-6">
                <h1 class="m-0 text-dark">薪资模块</h1>
            </div><!-- /.col -->
            <div class="col-sm-6">
                <ol class="breadcrumb float-sm-right">
                    <li class="breadcrumb-item"><a href="/">首页</a></li>
                    <li class="breadcrumb-item active">薪资模块</li>
                    <li class="breadcrumb-item active">
                        <a href="">上传工资表</a>
                    </li>
                </ol>
            </div><!-- /.col -->
        </div><!-- /.row -->
    </div><!-- /.container-fluid -->
</div>
<!-- /内容标题栏 -->
<section class="content">
<div class="container-fluid">
    <div class="row">
        <div class="col-md-3"></div>
        <div class="col-md-6">
            <div class="card card-primary h-100 card-outline">
                <div class="card-header">
                    <h3 class="card-title">上传工资表</h3>
                </div>
                <form id="put" class="form" enctype="multipart/form-data" action="" method="post">
                    {% csrf_token %}
                <div class="card-body">
                        发放模式
                        <div class="border border-success"></div>
                        <div class="form-group row mt-3">
                            <label class="col-sm-2 col-form-label" style="color: red;text-align: right;">选择操作：</label>
                            <div class="col-sm-4">
                                <select id="operate" name="operate" class="form-control">
                                    <option value="1" selected>正常发送</option>
                                    <option value="0">补发之前</option>
                                </select>
                            </div>
                            <label class="col-sm-2 col-form-label" style="color: red;text-align: right;">处理模式：</label>
                            <div class="col-sm-4">
                                <input type="text" value="先预览，后发送。" class="form-control" readonly>
                            </div>
                        </div>
                        <div class="form-group row">
                         <label class="col-sm-2 col-form-label" style="color: red;text-align: right;" >发放渠道：</label>
                        <div class="input-group row col-sm-10 mt-1">
                            <div class="custom-control custom-checkbox">
                                  <input class="custom-control-input" type="checkbox" id="customCheckbox1" value="ent_wechat" checked name="send_way">
                                  <label for="customCheckbox1" class="custom-control-label">企业微信</label>
                            </div>
                            <div class="custom-control custom-checkbox ml-4">
                                  <input class="custom-control-input" type="checkbox" id="customCheckbox2" disabled  value="dingtalk" name="send_way">
                                  <label for="customCheckbox2" class="custom-control-label">钉钉</label>
                            </div>
                            <div class="custom-control custom-checkbox ml-4">
                                 <input class="custom-control-input custom-control-input-danger" type="checkbox" id="customCheckbox4" checked  value="email" name="send_way">
                                  <label for="customCheckbox4" class="custom-control-label">邮件</label>
                            </div>
                        </div>
                    </div>
                        发放年月【默认为当月发上月】
                        <div class="border border-primary"></div>
                        <div id="curent" class="form-group row mt-3">
                            <label class="col-sm-2 col-form-label" style="color: green;text-align: right;">年份：</label>
                             <div class="col-sm-4">
                                 <input type="text" class="form-control" name="send_year" value="{{ send_year }}">
                             </div>
                             <label class="col-sm-2 col-form-label" style="color: green;text-align: right;">月份：</label>
                             <div class="col-sm-4">
                                 <input type="text" class="form-control" name="send_month" value="{{ send_month }}">
                             </div>
                        </div>
                        <div id="bufa" class="form-group row" style="padding-top: 15px;">
                         <label class="col-sm-2 col-form-label" style="color: green;text-align: right;">补发年份：</label>
                         <div class="col-sm-4">
                             <input type="text" class="form-control" name="bufa_year" placeholder="输入年份，如：2020">
                         </div>
                         <label class="col-sm-2 col-form-label" style="color: green;text-align: right;">补发月份：</label>
                         <div class="col-sm-4">
                             <input type="text" class="form-control" name="bufa_month" placeholder="输入月份，如：08">
                         </div>
                     </div>
                    工资表
                    <div class="border border-primary"></div>
                    <div class="form-group row">
                    <label for="fileinput" class="float-left" style="color: #007bff;padding-top: 15px" >选择工资表: （格式仅支持：xlsx）</label>
                        <div class="input-group">
                            <div class="custom-file float-right">
                                <input type="file" class="custom-file-input" id="fileinput"  name="salary_file" accept=".xlsx">
                                <label class="custom-file-label" for="fileinput"></label>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="card-footer">
                    <input class="btn btn-info" type="submit" value="提交"/>
                    <button class="btn btn-default float-right" type="button" onclick="btn_cancel()">取消</button>
                </div>
                </form>
            </div>
        </div>
    </div>
</div>
{% if info %}
    <script type="text/javascript">
        info = '{{ info|safe }}'
        layui.use('layer',function () {
            var layer = layui.layer;
            layer.msg(info, function () {
            });
        })
    </script>
{% endif %}
</section>
{% endblock %}
